<!doctype html>
<html lang="en" ng-app="myApp">
<head>
  <meta charset="utf-8">
  <title>Dialog | Onsen UI</title>
  <link rel="stylesheet" href="../styles/app.css"/>
  <link rel="stylesheet" href="../../../../build/css/onsenui.css">
  <link rel="stylesheet" href="../../../../build/css/onsen-css-components.css">

  <script src="../../../../build/js/onsenui.js"></script>
  <script src="../../node_modules/angular/angular.js"></script>
  <script src="../../dist/angularjs-onsenui.js"></script>
  <script src="../app.js"></script>

  <style>
    .dialog-container {
      height: 250px;
    }
  </style>

  <script>
    var app = angular.module('myApp', ['onsen']);

    app.controller('MyCtrl', function($scope) {
      $scope.data = {
        name: '',
        description: '',
      };

      ons.createDialog('dialog.html').then(function(dialog) {
        $scope.dialog = dialog;
      });

      $scope.show = function() {
        $scope.dialog.show();
      };
    });

  </script>

</head>

<body ng-controller="MyCtrl">
  <ons-page>
    <ons-toolbar>
      <div class="center">Dialog</div>
    </ons-toolbar>

    <div style="text-align: center">
      <p>Name: <strong>{{ data.name || 'Unknown' }}</strong></p>
      <p>Description: {{ data.description || 'No description yet...' }}</p>

      <br />
      <ons-button ng-click="show()">Edit</ons-button>
    </div>
  </ons-page>

  <script type="text/ons-template" id="dialog.html">
    <ons-dialog animation="default" cancelable>
      <ons-navigator animation="slide" var="app.navi">
        <ons-page>
          <ons-toolbar>
          <div class="center">Name</div>
          </ons-toolbar>
          <br />
          <div style="text-align: center">
            <ons-input modifier="underbar" id="name" label="Name" ng-model="data.name"></ons-input>
            <p>
              <ons-button modifier="light" ng-click="app.navi.pushPage('page.html');">Next</ons-button>
            </p>
          </div>
          </ons-page>
      </ons-navigator>
    </ons-dialog>
  </script>

  <ons-template id="page.html">
    <ons-page>
      <ons-toolbar>
        <div class="center">Description</div>
      </ons-toolbar>
      <br />
      <div style="text-align: center">
        <ons-input modifier="underbar" id="description" ng-model="data.description"></ons-input>
        <p>
          <ons-button modifier="light" ng-click="app.navi.popPage();">Previous</ons-button>
        </p>
      </div>
    </ons-page>
  </ons-template>

</body>
</html>
